﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace HOTEL.Dao
{
    public class ChitietphieudatDao: BaseDAO
    {
        public void XoaChiTietPhieuDat(string maPhieuDat)
        {
            var deleteOrderDetails =
            from details in _db.CT_PHIEU_DAT_PHONGs
            where details.MaPhieuDat == maPhieuDat
            select details;

            foreach (var detail in deleteOrderDetails)
            {
                _db.CT_PHIEU_DAT_PHONGs.DeleteOnSubmit(detail);
            }

            try
            {
                _db.SubmitChanges();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                // Provide for exceptions.
            }

        }
    }
}
